import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { resolve } from 'path' // 主要用于alias文件路径别名

const pathResolve = (dir) => resolve(__dirname, dir)

export default defineConfig({
  plugins: [vue()],
  // 路径代理
  resolve:{
    alias: {
      '@': pathResolve('./src'),
    },
    extensions: ['.js','.ts', '.vue', '.scss', '*']
  },
  // 跨域代理
  server: {
    proxy: {
      "/api": {
        target: 'http://10.1.16.197:9088/api',
        // target: "http://192.168.0.56:8080/api",
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, ''),
      },
    }
  },
  css:{
    preprocessorOptions: {
      scss: {
        additionalData: `@import "./src/assets/systemCss/config.scss";`
      }
    }
  } 
})